Page({
  data: {
    info: {},
    list: [],
    cur: ''
  },
  onLoad(query) {
    let that = this;
    let appid = my.getAppIdSync().appId
    my.showLoading();
    my.request({
      url: 'https://php.tongcangart.com/app/Message/info?appid=' + appid + '&status=' + my.getStorageSync({ key: 'status' }).data,
      method: 'POST',
      headers: {
        'content-type': 'application/json', 
      },
      dataType: 'json',
      success: function (res) {
        let data = JSON.parse(res.data.data);
        that.setData({
          info: data,
          list: data.e2
        })
      },
      fail: function (res) {
        console.log(res);
      },
      complete: function (res) {
        my.hideLoading();
      },
    });
  },
  setCur(e) {
    let cur = e.target.dataset.name;
    let tip1 = e.target.dataset.tip1;
    let tip2 = e.target.dataset.tip2;
    this.setData({
      cur,
      tip1,
      tip2,
    })
  },
  navigateBack() {
    my.navigateBack({
      delta: 2 
    }); // 返回上一页
  },
  handleCopy(e) {
    my.setClipboard({
      text: e.target.dataset.url,
      success: function(res) {
        my.showToast({
          type: 'success',
          content: '复制成功',
          duration: 1000,
        });
      },
      fail: function(res) {
        console.log(res, 88)
      }
    });
  },
  onReady() {
    // 页面加载完成
  },
  onShow() {
    // 页面显示
  },
  onHide() {
    // 页面隐藏
  },
  onUnload() {
    // 页面被关闭
  },
  onTitleClick() {
    // 标题被点击
  },
  onPullDownRefresh() {
    // 页面被下拉
  },
  onReachBottom() {
    // 页面被拉到底部
  },
  onShareAppMessage() {
    // 返回自定义分享信息
    return {
      title: 'My App',
      desc: 'My App',
      path: 'pages/index/index',
    };
  },
});
